//
//  NewsTableViewCell.m
//  JiuJiuShangCheng
//
//  Created by jiujiukeji on 2018/7/11.
//  Copyright © 2018年 jiujiukeji. All rights reserved.
//

#import "NewsTableViewCell.h"

@implementation NewsTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setUpUI];
    }
    return self;
}
- (void)setUpUI
{
    WeakSelf
    self.goodsImg = [[UIImageView alloc] init];
    _goodsImg.image = UIImageNamed(@"apple1");
    [self addSubview:_goodsImg];
    [_goodsImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_offset(CGSizeMake(rateHeight(160), rateHeight(190)));
        make.left.equalTo(self).offset(rateWidth(30));
        make.centerY.equalTo(self);
    }];
    
    self.titleLB = [UILabel labelWithText:@"" textColor:UIColorFromRGB(0x333333) fontSize:15];
    [_titleLB sizeToFit];
    [self addSubview:_titleLB];
    [_titleLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.goodsImg);
        make.left.equalTo(weakSelf.goodsImg.mas_right).offset(rateWidth(30));
        make.width.mas_lessThanOrEqualTo(@(rateWidth(450)));
    }];
    
    self.describeLB = [UILabel labelWithText:@"" textColor:UIColorFromRGB(0x999999) fontSize:12];
    _describeLB.numberOfLines = 0;
    [self addSubview:_describeLB];
    [_describeLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.titleLB);
        make.top.equalTo(weakSelf.titleLB.mas_bottom).offset(rateHeight(24));
        make.width.mas_lessThanOrEqualTo(@(rateWidth(450)));
        make.height.mas_lessThanOrEqualTo(@(rateHeight(100)));
    }];
    
    self.commentBtn = [UIButton buttonWithTitle:@"  888" fontSize:11 titleColor:UIColorFromRGB(0xc4c4c4) background:kClearColor cornerRadius:0];
    [_commentBtn setImage:UIImageNamed(@"liuyan") forState:(UIControlStateNormal)];
    [_commentBtn sizeToFit];
    [self addSubview:_commentBtn];
    [_commentBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.titleLB);
        make.bottom.equalTo(weakSelf.goodsImg);
    }];
    
    self.likeBtn = [UIButton buttonWithTitle:@"  999" fontSize:11 titleColor:UIColorFromRGB(0xc4c4c4) background:kClearColor cornerRadius:0];
    [_likeBtn setImage:UIImageNamed(@"dianzan9") forState:(UIControlStateNormal)];
    [_likeBtn sizeToFit];
    [self addSubview:_likeBtn];
    [_likeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.commentBtn.mas_right).offset(rateWidth(25));
        make.bottom.equalTo(weakSelf.commentBtn);
    }];
    _likeBtn.hidden = YES;
    
    self.line = [[UIView alloc] init];
    _line.backgroundColor = globalGray;
    [self addSubview:_line];
    [_line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.equalTo(self);
        make.height.equalTo(@(rateHeight(2)));
    }];
}

@end
